<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function ajax(url) {
            fetch(url).then(data => data.json()).then(data => dataGen.next(data))
        }
        function* steps() {
            console.log('fetching beers');
            const beers = yield ajax('http://api.react.beer/v2/search?q=hops&type=beer');
            console.log(beers);

            console.log('feching wes');
            const wes = yield ajax('http://api.github.com/users/wesbos');
            console.log(wes);

            console.log('fetching fat joe');
            const fatJoe = yield ajax('https://api.discogs.com/artistes/51980');
            console.log(fatJoe);
        }

        const dataGen = steps()
        dataGen.next()
    </script>
</body>

</html>